import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.game.base.SimulationObject;
import com.game.manager.SobManager;
import com.game.nonperfomers.item.Assignment;
import com.game.performers.Actor;
import com.helper.Cast;
import com.module.assignment.AssignmentManager;
import com.module.login.LoginManager;
import com.module.mail.MailManager;
import com.module.regrole.RegInfo;
import com.module.regrole.RegRoleManager;
import com.server.User;



public class TestLook extends SimulationObject {
	public TestLook(){
	}
	public static void main(String[] args) {
		try {
			String str = "#1";
			if(str.charAt(0)=='-')
				System.out.println("true");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void testparseInt(){
		String str = "#1";
		System.out.println(Cast.toInteger(str));
	}
	public static void testdoubleint(){
		int i = 1322532876;
		long d = System.currentTimeMillis();
		System.out.println(i-(int)(d/1000));
	}
	
	public static void testpoint(){
		ispointin(1, 1, 3, 3, -1, -1);
	}
	
	public static void ispointin(int iX1,int iY1,int iX2,int iY2,int iX,int iY){
		if(iX1 == iX || iX2 == iX || (int)((iX1-iX)^(iX2-iX)) < 0){
			if(iY1 == iY || iY2 == iY || (int)((iY1-iY)^(iY2-iY)) < 0){
				System.out.println("true");
				return;
			}
		}
		System.out.println("false");
	}
	
	public static void testGetAssignments(){
		List<SimulationObject> list = AssignmentManager.getAssignments(1002);
		System.out.println(list);
	}
	
	public static void testAcceptAssignment(){
		Actor role = (Actor)SobManager.get().getSob(1002);
		Assignment assignment = AssignmentManager.acceptAssign(role.id, 10001);
		System.out.println(assignment);
	}
	
	public static void testItemInitFields(){
		Assignment assignment = new Assignment();
		assignment.cfg_id = 10001;
		assignment.initInstance();
	}
	
	
	public static void testSendMails(){
		System.out.println(new Date().getTime());
		for(Integer i=0;i<10000;i++){
			MailManager.sendMail("test测试"+i, "内容测试"+i, 1002, "张昌彪", 1002);
		}
		System.out.println(new Date().getTime());
	}
	
	public static void testsendMails(){
		for(Integer i=0;i<1000;i++){
			MailManager.sendMail("test"+i.toString(), "content"+i.toString(), 1002, "张昌彪", 1002);			
		}
	}
	
	public static void testgetMails(){
		System.out.println(MailManager.getMailsById(1002));
		System.out.println(MailManager.getContentByCid(3));
	}
	
	public static void testlogin(){
		LoginManager.login("chzcb", null);
	}
	
	public static void testregRole(){
		User user = User.getUser(1001);
		RegInfo info = new RegInfo();
		info.name = "彪";
		info.sex = 1;
		info.role = 1;
		RegRoleManager.createRole(user, info, null);
	}
}
